Here's my commented code for Spaaace. Might be good for anyone getting started as it doesn't contain too many fancy tricks.
10 C = 4 : REM set the number of stars flying by - any more than 4 and it starts getting a bit slow
20 HOME : REM clear the text screen
30 GR : REM turn on low res graphics
40 SPEED= 220 : REM set the text speed to a bit slower than normal for the intro text
50 FOR I = 31 TO 16 STEP - 1 : REM loop through horizontal positions for the intro text
60 VTAB 21 : REM position cursor just below the graphics
70 HTAB I : REM position cursor horizontally via looping value
80 PRINT "Spaaace!!! " : REM print space at that position - note space character on end to wipe out the last character as it shifts over to the left in the next iteration
90 NEXT : REM loop to 50
100 F = 0 : REM basically a boolean to store the state of flames coming out the back of the rocket
110 COLOR= 15 : REM set to white
120 PLOT 19,15 : REM plot the white pixel for the space ship
130 DIM N(40) : REM set up an array of pre-calculated values for the next value of a star position - it makes the code run faster to pre-calc - eg given position 5, n(5) will be 6
140 DIM P(40) : REM array of pre-calc values for last position of a star, eg given 5, p(5) will be 4
150 FOR I = 1 TO 40 : REM loop to assign pre-calc values - really only needs to go to 38
160 N(I) = I + 1 : REM set the next position, eg n(5) = 5 + 1 = 6
170 P(I) = I - 1 : REM set the prior position, eg p(5) = 5 - 1 = 4
180 NEXT : REM loop to 150
190 N(38) = 1 : REM when a star reaches the right side of the screen, set its next position to 1
200 P(1) = 38 : REM if a star is in position 1, it’s prior position was 38
210 DIM X(C) : REM array for current x positions of all the stars
220 DIM Y(C) : REM array for current y positions of all the stars
230 FOR I = 1 TO C : REM loop to assign random starting positions
240 Y(I) = INT ( RND (1) * 40) : REM get a random number between 0 and 40 and make sure it’s an integer instead of a float (eg 26.7316 gets converted to just 26) - y position of star I
250 X(I) = INT ( RND (1) * 30) + 1 : REM random x position of star I
260 NEXT : REM loop to 230
270 FOR A = 1 TO 3 : REM this is a bogus loop that never ends. I needed this so that I could effectively goto the middle of line 2 instead of the the start of line 2 because I had so much set up code before the main loop
280 FOR I = 1 TO C : REM cycle through each star
290 COLOR= 2 : REM set the color to dark blue
300 X = X(I) : REM assign array value of x of current star to simple value to avoid multiple use of slower array indexing
310 Y = Y(I) : REM same for y value of star
320 PLOT X,Y : REM plot the star!
330 COLOR= 0 : REM set colour to black
340 PLOT P(X),Y : REM find out the prior position of the star by using pre-calc and plotting black pixel to wipe it out
350 X(I) = N(X) : REM set next x value of the star using pre-calced values
360 NEXT : REM loop to 280 to plot next star
370 COLOR= 8 + (F > 0) * 5 : REM set the color of the spaceship flames, 8 (brown), or, if f > 0 (ie 1), then 8 + (1)*5 = 13 (yellow)
380 PLOT 20,15 : REM plot the flames
390 F = NOT F : REM flip the flame status - if f = 0, it becomes 1, if it’s 1 it becomes 0
400 A = 1 : REM set A to 1 to ensure the bogus loop never ends
410 NEXT : REM loop back to 270